<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>垂直居中</title>
    <style>
        div{
            height: 100px;
            background-color: blue;
            /* 只能是单行文字垂直居中 */
            line-height: 100px;
        }
    </style>
</head>
<body>
    <div>文<br>字</div>
</body>
</html>